package com.king.pattem.observer;

import java.util.Vector;

/**
 * @author taomk
 * @version 1.0
 * @since 15-1-17 下午2:48
 */
public class ConcreteSubject implements ISubject {

	private Vector<IObserver> observers = new Vector<>();

	@Override
	public void attach(IObserver observer) {
		observers.addElement(observer);
	}

	@Override
	public void detach(IObserver observer) {
		observers.removeElement(observer);
	}

	@Override
	public void inform() {
		for (IObserver observer : observers) {
			observer.update();
		}
	}
}
